package crivia.ecp.carry.em;

import crivia.ecp.carry.html.table.Table;

public abstract class AbilityTable extends Table {
	
	public enum Type {
		ViewForm(Type_ViewForm)
		,ListStyle(Type_ListStyle)
		,LayoutTable(Type_LayoutTable)
		;
		private final String s;
		Type(String s){this.s=s;}
		public String toString() {return s;}
	}
	private static final String Type_ViewForm = "Viewform";
	private static final String Type_ListStyle = "ListStyle";
	private static final String Type_LayoutTable = "LayoutTable";
	
	public enum Line {
		Line0(Line_0)
		,Line1(Line_1)
		;
		private final String s;
		Line(String s){this.s=s;}
		public String toString() {return s;}
	}
	private static final String Line_0 = "Line";
	private static final String Line_1 = "Line1";

	public static final String Style_Row_ListHead = "HeaderForXtalbe";
	public static final String Style_Row_ListLight = "DataLight";
	public static final String Style_Row_ListDark = "DataDark";
	
	public static final String Style_Cell_Field = "Field";
	public static final String Style_Cell_EditerTitle = "fieldName";
	public static final String Style_Cell_Editer = "field";
	
	public AbilityTable(Type type){
		setType(type);
	}
	
	public AbilityTable(Type type,Table table){
		super(table);
		setType(type);
	}
	
	@Override
	protected String innerHTML() {
		StringBuilder tStr = new StringBuilder();
		colGroup(tStr);

		innerStyle(tStr);

		return tStr.toString();
	}
	
	@Override
	public String toString() {
		ownStyle();
		if (null != type){
			setCssClass(type.toString());
		}
		return super.toString();
	}
	
	private Type type;
	public Type getType() {
		return type;
	}
	public AbilityTable setType(Type type) {
		this.type = type;
		return this;
	}
	
	protected abstract void ownStyle();
	
	protected abstract void innerStyle(StringBuilder tStr);

}
